.class public final Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;
.super Landroid/widget/FrameLayout;
.source "GPSUSBSettingsView.kt"


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1

    const-string v0, "context"

    invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    .line 23
    invoke-direct {p0, p1}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V

    .line 24
    invoke-direct {p0, p1}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;->initialize(Landroid/content/Context;)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1

    const-string v0, "context"

    invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    .line 26
    invoke-direct {p0, p1, p2}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 27
    invoke-direct {p0, p1}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;->initialize(Landroid/content/Context;)V

    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 1

    const-string v0, "context"

    invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    .line 29
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 30
    invoke-direct {p0, p1}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;->initialize(Landroid/content/Context;)V

    return-void
.end method

.method public static final synthetic access$resetChecked(Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Llt/minvib/magicpreferences/MagicIntegerPreference;)V
    .locals 0

    .line 21
    invoke-direct {p0, p1, p2, p3}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;->resetChecked(Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Llt/minvib/magicpreferences/MagicIntegerPreference;)V

    return-void
.end method

.method private final createAdapter(Landroid/widget/Spinner;Ljava/util/List;)Landroid/widget/ArrayAdapter;
    .locals 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/widget/Spinner;",
            "Ljava/util/List<",
            "Llt/farmis/libraries/externalgps/utils/NamedInt;",
            ">;)",
            "Landroid/widget/ArrayAdapter<",
            "Llt/farmis/libraries/externalgps/utils/NamedInt;",
            ">;"
        }
    .end annotation

    .line 110
    new-instance v0, Landroid/widget/ArrayAdapter;

    invoke-virtual {p0}, Landroid/widget/FrameLayout;->getContext()Landroid/content/Context;

    move-result-object v1

    const v2, 0x1090008

    invoke-direct {v0, v1, v2, p2}, Landroid/widget/ArrayAdapter;-><init>(Landroid/content/Context;ILjava/util/List;)V

    const p2, 0x1090009

    .line 111
    invoke-virtual {v0, p2}, Landroid/widget/ArrayAdapter;->setDropDownViewResource(I)V

    .line 112
    invoke-virtual {p1, v0}, Landroid/widget/Spinner;->setAdapter(Landroid/widget/SpinnerAdapter;)V

    return-object v0
.end method

.method private final initAdapter(Landroid/widget/Spinner;Ljava/util/List;Llt/minvib/magicpreferences/MagicIntegerPreference;)Landroid/widget/ArrayAdapter;
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/widget/Spinner;",
            "Ljava/util/List<",
            "Llt/farmis/libraries/externalgps/utils/NamedInt;",
            ">;",
            "Llt/minvib/magicpreferences/MagicIntegerPreference;",
            ")",
            "Landroid/widget/ArrayAdapter<",
            "Llt/farmis/libraries/externalgps/utils/NamedInt;",
            ">;"
        }
    .end annotation

    .line 104
    invoke-direct {p0, p1, p2}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;->createAdapter(Landroid/widget/Spinner;Ljava/util/List;)Landroid/widget/ArrayAdapter;

    move-result-object p2

    .line 105
    invoke-direct {p0, p2, p1, p3}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;->resetChecked(Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Llt/minvib/magicpreferences/MagicIntegerPreference;)V

    return-object p2
.end method

.method private final initialize(Landroid/content/Context;)V
    .locals 26

    move-object/from16 v13, p0

    .line 34
    invoke-static/range {p1 .. p1}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

    move-result-object v0

    const/4 v1, 0x0

    const v2, 0x7f0c0067

    invoke-virtual {v0, v2, v13, v1}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;

    move-result-object v14

    .line 35
    invoke-virtual/range {p0 .. p0}, Landroid/widget/FrameLayout;->removeAllViews()V

    .line 36
    invoke-virtual {v13, v14}, Landroid/widget/FrameLayout;->addView(Landroid/view/View;)V

    const v0, 0x7f090286

    .line 38
    invoke-virtual {v13, v0}, Landroid/widget/FrameLayout;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    const v2, 0x7f090287

    .line 39
    invoke-virtual {v13, v2}, Landroid/widget/FrameLayout;->findViewById(I)Landroid/view/View;

    move-result-object v2

    check-cast v2, Landroid/widget/LinearLayout;

    .line 41
    invoke-virtual/range {p1 .. p1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v3

    const-string v4, "android.hardware.usb.host"

    invoke-virtual {v3, v4}, Landroid/content/pm/PackageManager;->hasSystemFeature(Ljava/lang/String;)Z

    move-result v3

    const/16 v4, 0x8

    const-string v5, "mainLayout"

    const-string v6, "errorMessage"

    if-eqz v3, :cond_0

    .line 42
    invoke-static {v0, v6}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v0, v4}, Landroid/widget/TextView;->setVisibility(I)V

    .line 43
    invoke-static {v2, v5}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v2, v1}, Landroid/widget/LinearLayout;->setVisibility(I)V

    goto :goto_0

    .line 45
    :cond_0
    invoke-static {v0, v6}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setVisibility(I)V

    .line 46
    invoke-static {v2, v5}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v2, v4}, Landroid/widget/LinearLayout;->setVisibility(I)V

    :goto_0
    const v0, 0x7f09006e

    .line 49
    invoke-virtual {v14, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    move-object v15, v0

    check-cast v15, Landroid/widget/Spinner;

    const v0, 0x7f0900ca

    .line 50
    invoke-virtual {v14, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    move-object v12, v0

    check-cast v12, Landroid/widget/Spinner;

    const v0, 0x7f090235

    .line 51
    invoke-virtual {v14, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    move-object v11, v0

    check-cast v11, Landroid/widget/Spinner;

    const v0, 0x7f0901b2

    .line 52
    invoke-virtual {v14, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    move-object v10, v0

    check-cast v10, Landroid/widget/Spinner;

    const v0, 0x7f090113

    .line 53
    invoke-virtual {v14, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    move-object v9, v0

    check-cast v9, Landroid/widget/Spinner;

    const-string v0, "baudRates"

    .line 55
    invoke-static {v15, v0}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    sget-object v0, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v0

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS;->getBaudRateList()Ljava/util/List;

    move-result-object v0

    sget-object v1, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_BAUD_RATE:Llt/minvib/magicpreferences/MagicIntegerPreference;

    const-string v2, "Preferences.GPS_USB_BAUD_RATE"

    invoke-static {v1, v2}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-direct {v13, v15, v0, v1}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;->initAdapter(Landroid/widget/Spinner;Ljava/util/List;Llt/minvib/magicpreferences/MagicIntegerPreference;)Landroid/widget/ArrayAdapter;

    move-result-object v16

    const-string v0, "dataBits"

    .line 56
    invoke-static {v12, v0}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    sget-object v0, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v0

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS;->getDataBitsList()Ljava/util/List;

    move-result-object v0

    sget-object v1, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_DATA_BITS:Llt/minvib/magicpreferences/MagicIntegerPreference;

    const-string v2, "Preferences.GPS_USB_DATA_BITS"

    invoke-static {v1, v2}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-direct {v13, v12, v0, v1}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;->initAdapter(Landroid/widget/Spinner;Ljava/util/List;Llt/minvib/magicpreferences/MagicIntegerPreference;)Landroid/widget/ArrayAdapter;

    move-result-object v17

    const-string v0, "stopBits"

    .line 57
    invoke-static {v11, v0}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    sget-object v0, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v0

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS;->getStopBitsList()Ljava/util/List;

    move-result-object v0

    sget-object v1, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_STOP_BITS:Llt/minvib/magicpreferences/MagicIntegerPreference;

    const-string v2, "Preferences.GPS_USB_STOP_BITS"

    invoke-static {v1, v2}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-direct {v13, v11, v0, v1}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;->initAdapter(Landroid/widget/Spinner;Ljava/util/List;Llt/minvib/magicpreferences/MagicIntegerPreference;)Landroid/widget/ArrayAdapter;

    move-result-object v18

    const-string v0, "parity"

    .line 58
    invoke-static {v10, v0}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    sget-object v0, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v0

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS;->getParitiesList()Ljava/util/List;

    move-result-object v0

    sget-object v1, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_PARITY:Llt/minvib/magicpreferences/MagicIntegerPreference;

    const-string v2, "Preferences.GPS_USB_PARITY"

    invoke-static {v1, v2}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-direct {v13, v10, v0, v1}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;->initAdapter(Landroid/widget/Spinner;Ljava/util/List;Llt/minvib/magicpreferences/MagicIntegerPreference;)Landroid/widget/ArrayAdapter;

    move-result-object v19

    const-string v0, "flowControl"

    .line 59
    invoke-static {v9, v0}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    sget-object v0, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v0

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS;->getFlowControlList()Ljava/util/List;

    move-result-object v0

    sget-object v1, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_FLOW_CONTROL:Llt/minvib/magicpreferences/MagicIntegerPreference;

    const-string v2, "Preferences.GPS_USB_FLOW_CONTROL"

    invoke-static {v1, v2}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-direct {v13, v9, v0, v1}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;->initAdapter(Landroid/widget/Spinner;Ljava/util/List;Llt/minvib/magicpreferences/MagicIntegerPreference;)Landroid/widget/ArrayAdapter;

    move-result-object v20

    const v0, 0x7f0901d5

    .line 61
    invoke-virtual {v14, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v8

    if-eqz v8, :cond_1

    new-instance v7, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$1;

    move-object v0, v7

    move-object/from16 v1, p0

    move-object/from16 v2, p1

    move-object/from16 v3, v16

    move-object v4, v15

    move-object/from16 v5, v17

    move-object v6, v12

    move-object v13, v7

    move-object/from16 v7, v18

    move-object/from16 v21, v15

    move-object v15, v8

    move-object v8, v11

    move-object/from16 v22, v9

    move-object/from16 v9, v19

    move-object/from16 v23, v10

    move-object/from16 v24, v11

    move-object/from16 v11, v20

    move-object/from16 v25, v12

    move-object/from16 v12, v22

    invoke-direct/range {v0 .. v12}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$1;-><init>(Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;Landroid/content/Context;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;)V

    invoke-static {v15, v13}, Lcom/mcxiaoke/koi/ext/ViewKt;->onClick(Landroid/view/View;Lkotlin/jvm/functions/Function1;)V

    goto :goto_1

    :cond_1
    move-object/from16 v22, v9

    move-object/from16 v23, v10

    move-object/from16 v24, v11

    move-object/from16 v25, v12

    move-object/from16 v21, v15

    :goto_1
    const v0, 0x7f090057

    .line 77
    invoke-virtual {v14, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v0

    if-eqz v0, :cond_2

    new-instance v13, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;

    move-object v1, v13

    move-object/from16 v2, v16

    move-object/from16 v3, v21

    move-object/from16 v4, v17

    move-object/from16 v5, v25

    move-object/from16 v6, v18

    move-object/from16 v7, v24

    move-object/from16 v8, v19

    move-object/from16 v9, v23

    move-object/from16 v10, v20

    move-object/from16 v11, v22

    move-object/from16 v12, p1

    invoke-direct/range {v1 .. v12}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;-><init>(Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/content/Context;)V

    invoke-static {v0, v13}, Lcom/mcxiaoke/koi/ext/ViewKt;->onClick(Landroid/view/View;Lkotlin/jvm/functions/Function1;)V

    :cond_2
    return-void
.end method

.method private final resetChecked(Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Llt/minvib/magicpreferences/MagicIntegerPreference;)V
    .locals 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/widget/ArrayAdapter<",
            "Llt/farmis/libraries/externalgps/utils/NamedInt;",
            ">;",
            "Landroid/widget/Spinner;",
            "Llt/minvib/magicpreferences/MagicIntegerPreference;",
            ")V"
        }
    .end annotation

    const/4 v0, 0x0

    .line 117
    invoke-virtual {p2, v0}, Landroid/widget/Spinner;->setOnItemSelectedListener(Landroid/widget/AdapterView$OnItemSelectedListener;)V

    .line 119
    new-instance v0, Llt/farmis/libraries/externalgps/utils/NamedInt;

    invoke-virtual {p0}, Landroid/widget/FrameLayout;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-virtual {p3, v1}, Llt/minvib/magicpreferences/MagicIntegerPreference;->get(Landroid/content/Context;)Ljava/lang/Integer;

    move-result-object p3

    const-string v1, "preference.get(context)"

    invoke-static {p3, v1}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {p3}, Ljava/lang/Integer;->intValue()I

    move-result p3

    const-string v1, ""

    invoke-direct {v0, v1, p3}, Llt/farmis/libraries/externalgps/utils/NamedInt;-><init>(Ljava/lang/String;I)V

    invoke-virtual {p1, v0}, Landroid/widget/ArrayAdapter;->getPosition(Ljava/lang/Object;)I

    move-result p1

    const/4 p3, -0x1

    if-le p1, p3, :cond_0

    .line 121
    invoke-virtual {p2, p1}, Landroid/widget/Spinner;->setSelection(I)V

    :cond_0
    return-void
.end method
